﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MongoDB.Bson.Serialization;
using Shop.Core.Domain.Catalog;
using MongoDB.Bson.Serialization.Options;
using MongoDB.Bson.Serialization.IdGenerators;
using Shop.Core;

namespace Shop.Data.Mongo.Catalog
{
    public class ProductTemplateMap
    {
        public void Map()
        {
            BsonClassMap.RegisterClassMap<ProductTemplate>(cm =>
            {
                //cm.MapIdMember(p=>p.Id).SetIdGenerator(StringObjectIdGenerator.Instance);
                cm.AutoMap();
                cm.GetMemberMap(c => c.CreatedOn).SetSerializationOptions(DateTimeSerializationOptions.UtcInstance);
                cm.GetMemberMap(c => c.ModifiedOn).SetSerializationOptions(DateTimeSerializationOptions.UtcInstance);
            });
        }
    }
}
